package jiqiao;

public class SingleNumber {
    public static void main(String[] args) {
        int[] nums = {1, 2, 1, 3, 2};
        System.out.println(singleNumber(nums));
    }

    private static int singleNumber(int[] nums) {
        int single = 0;
        for (int num : nums) {
            //按位与异或运算，相同为0，不同为1
            single ^= num;
        }
        return single;
    }

}

